package com.zym.init.model.query;

import com.zym.init.core.annotation.EnumRange;
import com.zym.init.enums.RoleStatusEnum;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.groups.Default;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Set;

/**
 * 角色查询对象
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class RoleQuery extends PageQuery {
    /**
     * ID
     */
    @NotNull(message = "角色ID不能为空", groups = {RoleQuery.Update.class})
    private Long roleId;

    /**
     * 角色名称
     */
    @NotEmpty(message = "角色名称不能为空", groups = {RoleQuery.Add.class})
    private String roleName;

    /**
     * 角色代码
     */
    @NotEmpty(message = "角色代码不能为空", groups = {RoleQuery.Add.class})
    private String roleCode;

    /**
     * 权限列表
     */
    private Set<String> permissionList;

    /**
     * 角色描述
     */
    private String roleDesc;

    /**
     * 状态：(1:启用[active] 2:禁用[inactive])
     */
    @EnumRange(message = "角色状态错误", enumClass = RoleStatusEnum.class, enumValidMethod = "isValidCode", groups = {Update.class, Add.class})
    @NotEmpty(message = "状态不能为空", groups = {RoleQuery.Add.class})
    private String status;

    /**
     * 新增校验组
     */
    public interface Add extends Default {
    }

    /**
     * 更新校验组
     */
    public interface Update extends Default {
    }

}
